const o = {
  name: '张三',
  age: 18,
  sex: '男',
  money: 100000
};

// 代理/拦截
const obj = new Proxy(o, {
  get(target, propKey) {
    if (propKey === 'money') return '******'
    return target[propKey]
  },
  set(target, propKey, value) {
    console.log('修改的是' + propKey, '新值： ' + value, '老值： ' + target[propKey])
    target[propKey] = value
  }
})

obj.name = '李四'

console.log(obj.name)
console.log(obj.age)
console.log(obj.sex)
console.log(obj.money)
